<template>
    <j-modal
            :width="1200"
            :visible="visible"
            :maskClosable="false"
            fullscreen
            @ok="handleOk"
            @cancel="handleCancel">
        <msi-server-task-form ref="realForm" @ok="submitCallback" :disabled="disableSubmit"/>
    </j-modal>
</template>

<script>

    import MsiServerTaskForm from './MsiServerTaskForm'

    export default {
        name: 'MsiServerTaskModal',
        components: {
            MsiServerTaskForm,
        },
        data() {
            return {
                title: '',
                visible: false,
                disableSubmit: false,
            }
        },
        methods: {
            add(msiServer) {
                this.visible = true
                this.$nextTick(() => {
                    this.$refs.realForm.add(msiServer)
                })
            },
            edit(record) {
                this.visible = true
                this.$nextTick(() => {
                    this.$refs.realForm.edit(record)
                })
            },
            close() {
                this.$emit('close')
                this.visible = false
            },
            handleOk() {
                this.$refs.realForm.submitForm()
            },
            submitCallback() {
                this.$emit('ok')
                this.visible = false
            },
            handleCancel() {
                this.close()
            }
        }
    }
</script>

<style scoped>
</style>
